{layout name="../common/master"/}
<div id="right">
	<form action="" method="post" role="form" >
		<div class="form-group">
			<label style="float: left;margin-right: 5px;padding-top: 8px" for="" >角色名</label>
			<input style="width: 200px;float: left;margin-right: 20px" type="text" class="form-control" name="name" id="" placeholder="请输入角色名">
			<button style="float: left;margin-right: 20px" type="submit" class="btn btn-primary">搜索</button>
			<a style="float: left;" href="{:URL('home/systemmanage/addgroup')}" class="btn btn-primary">添加角色</a>
		</div>
	</form>
	<p style="width: 100%;height: 10px;clear: both"></p>
	<table class="table table-bordered table-hover">
		<thead>
			<tr>
				<th>序号</th>
				<th>角色名称</th>
				<th>标号</th>
				<!--<th>内容</th>-->
				<th>操作</th>
			</tr>
		</thead>
		<tbody>
		{foreach name="list" item="vo" key="k" }
			<tr>
				<td>{$vo['id']}</td>
				<td>{$vo['name']}</td>
				<td>{$vo['num']}</td>
				<!--<td>{$vo['content']}</td>-->
				<td>
						<a href="{:URL('home/Systemmanage/setauthority',['id'=>$vo['id']])}" class="btn btn-xs btn-primary">设置权限</a>
					  {if condition="$vo['status'] eq 1"}
					<a href="javascript:;" rid="{$vo['id']}"  class="unuse btn btn-xs btn-danger">禁用</a>
					{elseif condition="$vo['status'] eq 0"/}
					<a href="javascript:;" rid="{$vo['id']}"  class="use btn btn-xs btn-success">启用</a>
				       {/if}
				</td>
			</tr>
		{/foreach}
		</tbody>
	</table>
</div>
<script>
	$(function(){
		$('.unuse').click(function(){
			var id=$(this).attr('rid');
			$.post("{:URL('home/Systemmanage/delrole')}",{id:id,type:0},function(res){
				layer.msg(res.msg);
				location.href="{:URL('home/Systemmanage/authoritymanage')}";
			})
		})
		$('.use').click(function(){
			var id=$(this).attr('rid');
			$.post("{:URL('home/Systemmanage/delrole')}",{id:id,type:1},function(res){
				layer.msg(res.msg);
				location.href="{:URL('home/Systemmanage/authoritymanage')}";
			})
		})
	})
</script>
